<?php get_header(); ?>
	
	<script src="<?php bloginfo('template_directory'); ?>/js/jquery.isotope.min.js"></script>
	<script src="<?php bloginfo('template_directory'); ?>/js/richfiles_permalink.js"></script>
	<link media="screen" href="<?php bloginfo('template_directory'); ?>/richfiles_permalink.css" type="text/css" rel="stylesheet" />
	<link media="screen" href="<?php bloginfo('template_directory'); ?>/isotopes1.css" type="text/css" rel="stylesheet" />
	
	<?php

	$group_types = get_post_group_types();
	$post_group_primary = get_post_group_primary();
	$post_groups = get_post_groups();
	//print_r($group_types);exit;
	if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
	

		<div class="container-inner clearfix">
			<div class="clearfix">

				<span class="title1 fleft"><?php the_title() ?> </span> <span
					class="fright">NET WORTH <span class="title1"><?php echo $post_group_primary['Networth(in billion USD)'] ?>
				</span>
				</span>
			</div>
			<section id="content">
				<div id="container" class="super-list variable-sizes clearfix">

					<div class="element width900 height300">
						<div class="content">
							<?php the_post_thumbnail(); ?>
						</div>
					</div>
					<div class="element width300 height150">
						<div class="details">
							<div class="inner shadow">
								<div class="row">
									<div class="column align-center align-middle">
										<span class="block"><i class="icon-born"></i> </span>
										<span class="block">Born</span>
										<span class="block title4"><?php echo $post_group_primary['Birth place'] ?></span>
									</div>
								</div>
							</div>
						</div>
					</div>

					<div class="element width150 height150">
						<div class="details">
							<div class="inner shadow">
								<div class="row">
									<div class="column align-center align-middle">
										<span class="block"><i class="icon-born-in"></i> </span>
										<span class="block">Born In</span>
										<span class="block title4"><?php echo $post_group_primary['D.O.B.'] ?></span>
									</div>
								</div>
							</div>
						</div>
					</div>

					<div class="element width150 height150">
						<div class="details">
							<div class="inner shadow">
								<div class="row">
									<div class="column align-center align-middle">
										<span class="block"><i class="icon-marital-status"></i> </span>
										<span class="block">Marital Status</span>
										<span class="block title4"><?php echo $post_group_primary['Marital Status'] ?></span>
									</div>
								</div>
							</div>
						</div>
					</div>

					<div class="element width300 height150">
						<div class="details">
							<div class="inner shadow">
								<div class="row">
									<div class="column align-center align-middle">
										<span class="block"><i class="icon-occupation"></i> </span>
										<span class="block">Business</span>
										<span class="block title4"><?php echo substr( $post_group_primary['Business name'], 0, 17 )?></span>
									</div>
								</div>
							</div>
						</div>
					</div>

					<div class="element width750 height350">
						<div class="content bio">
							<?php the_content() ?>
						</div>
					</div>
					
					
				    <div class="element width300 height300">
				    	<div class="content">
							<span>
								<img src="<?php bloginfo('template_directory'); ?>/images/ad_300X250.jpg"></img>
							</span>
						</div>
					</div>
					

					
					<?php
					//print_r($post_groups);exit;
					$j=0;
					foreach($group_types as $key=>$group_type)
					{
						if( $key == 'Timeline' || $key == 'Family' || $key == 'Quotes' || $key == 'Video' || $key == 'Friends' || $key == 'Heirs' || $key == 'Trivia' || $key == 'Maps' || $key == 'Spouses & Girlfriends or Boyfriends')
							continue;

						if( !empty($post_groups[$key]) )
					    {
						    foreach($post_groups[$key] as $i=>$post_group)
						    {
						    	$thumbImage ='';
						    	if($post_group['Gallery'])
						    	{
							    	if( $elementWidth[$i] > 300 )
							    		$thumbImage = $post_group['Gallery']['elements'][0]['view'];
							    	else
							    		$thumbImage = $post_group['Gallery']['elements'][0]['image'];
							    }

						    	switch( $key ){

						    		case 'Estates and Homes' :
						    		case 'Holiday Destinations(Getaways)' :
						    		case 'Autos and Cars' :
						    		case 'Island' :
						    		$calulatdElementWidth = 670;
						    		break;

						    		default:
						    		$calulatdElementWidth = 300;


						    	}
						    ?>
								<div class="element width<?php echo $calulatdElementWidth ?> height600">
								<div class="content">
									<span class="toggleHoverText" rel="toggle<?php echo $i.$j ?>"><img src="<?php echo $thumbImage ?>"></img></span>
						      		<div class="absolute cornerTxt"><?php echo strtoupper( $key ) ?></div>
						      		
						      		<div class="hoverText hide" id="toggle<?php echo $i.$j ?>">
						      			<div class="innerText">
											<span class="title3 fleft"><?php echo $post_group['Title'] ?></span>
											
										</div>
										<div class="clear"></div>
										<div class="innerDesc">
											<?php echo $post_group['Description'] ?>
										</div>
										
										<div class="inline-carousel">
											<div class="top clearfix">
												<span class="fleft">
													<i class="icon-picture"></i> <?php echo count($post_group['Gallery']['elements']) ?>
												</span>
												
												
											</div>
											<div class="center clearfix">
												<a href="javascript:;" class="carousel-prev">
													<i class="icon-carousel-prev"></i>
												</a>
												
												<?php 
												foreach($post_group['Gallery']['elements'] as $element )
												{
												?>
													<div class="single">
														<div class="align-center">
															<img src="<?php echo $element['view'] ?>"></img>
														</div>
														
														<div class="title3">
															<?php echo $element['title'] ?>
														</div>
														
														<div class="content">
															<?php echo $element['desc'] ?>
														</div>
													</div>
												<?php 
												}
												?>
												
												
												<a href="javascript:;" class="carousel-next">
													<i class="icon-carousel-next"></i>
												</a>
											</div>
										</div><!-- /.inline-carousel -->
						      		</div> <!--eof hovertext -->
						      	</div> 
						    </div>
						    <?php
							} 
						}  
						$j++; 
					} 
				
					

					
					if($post_groups['Spouses & Girlfriends or Boyfriends'])
				    {
					    foreach($post_groups['Spouses & Girlfriends or Boyfriends'] as $post_group)
					    {
					    ?>
						    <a href="<?php echo $post_group['Link'] ?>" class="element width150 height150" >
						    	<div class="content family">
									<img src="<?php echo $post_group['Image']['view'] ?>"></img>
									<div class="text">
										<div class="row">
											<div class="column align-center align-middle">
												<span class="name title3"><?php echo $post_group['Name'] ?></span><br/>
												<span class="relation"><?php echo $post_group['Relationship'] ?></span>
											</div>
										</div>
									</div>
								</div>
							</a>
						<?php
						} 
					}


					if($post_groups['Family'])
				    {
					    foreach($post_groups['Family'] as $post_group)
					    {
					    ?>
						    <a href="<?php echo $post_group['Link'] ?>" class="element width150 height150" >
						    	<div class="content family">
									<img src="<?php echo $post_group['Image']['view'] ?>"></img>
									<div class="text">
										<div class="row">
											<div class="column align-center align-middle">
												<span class="name title3"><?php echo $post_group['Name'] ?></span><br/>
												<span class="relation"><?php echo $post_group['Relationship'] ?></span>
											</div>
										</div>
									</div>
								</div>
							</a>
						<?php
						} 
					}

					?>

					
			
					<div class="element width300 height300">
						<div class="content news">
							<span class="title2 absolute">NEWS</span>
							<span class="absolute next-prev">
								<a class="button prev disable" href="javascript:void(0);"><i class="icon-news-carousel-prev"></i></a>
								<a class="button next" href="javascript:void(0);"><i class="icon-news-carousel-next"></i></a>
							</span>
							<div class="inner">
								<a href="" class="single">
									Mark Zuckerberg pledges to give away majority of his wealth to
								</a>
								<div class="line-sep"></div>
								<a href="" class="single">
									Mark Zuckerberg pledges to give away majority of his wealth to
								</a>
								<div class="line-sep"></div>
								<a href="" class="single">
									Mark Zuckerberg pledges to give away majority of his wealth to
								</a>
								<div class="line-sep"></div>
								<a href="" class="single">
									Mark Zuckerberg pledges to give away majority of his wealth to
								</a>
								<div class="line-sep"></div>
								<a href="" class="single">
									Mark Zuckerberg pledges to give away majority of his wealth to
								</a>
							</div>
						</div>
					</div>
					
					 <?php
					if($post_groups['Quotes'])
				    {
					    foreach($post_groups['Quotes'] as $post_group)
					    {
					    ?>
						<div class="element width300 height300">
							<div class="content quotes">
								<div class="clearfix">
									
										<span class="absolute quotedBy">
											<span>QUOTED BY <?php strtoupper(the_title()) ?> </span><br/>
											<span><?php echo $post_group['Quoted By'] ?></span>
										</span>
									
									<!--span class="absolute quotedIcons">
										<a href="" class="button"><i class="icon-edit"></i></a>
										<a href="" class="button"><i class="icon-plus"></i></a>
									</span-->
								</div>
								
								<div class="inner-content">
									<?php echo $post_group['Quote'] ?>
								</div>
							</div>
						</div>
						
						<?php
					    }
					}
				    
				    

					if($post_groups['Friends'])
				    {
					    foreach($post_groups['Friends'] as $post_group)
					    {
					    ?>
						    <a href="<?php echo $post_group['Link'] ?>" class="element width150 height150" >
						    	<div class="content family">
									<img src="<?php echo $post_group['Image']['view'] ?>"></img>
									<div class="text">
										<div class="row">
											<div class="column align-center align-middle">
												<span class="name title3"><?php echo $post_group['Name'] ?></span><br/>
												<span class="relation"><?php echo $post_group['Relationship'] ?></span>
											</div>
										</div>
									</div>
								</div>
							</a>
						<?php
						} 
					}
					

					
				   
					if($post_groups['Video'])
					{
					    foreach($post_groups['Video'] as $post_group)
					    {
					    ?>
							<div class="element width300 height300">
								<div class="content video">
									<div class="clearfix">
										<span class="title2 fleft">VIDEO</span> <span class="fright"><a href="" class="button button-plus"><i class="icon-plus"></i></a></span>
									</div>
									<div class="image-block1">
										<?php echo $post_group['Video']['view'] ?>
									</div>
								</div>
							</div>
						<?php 
					    }
					}
					?>



				</div> <!-- /eof container -->
			</section>
			<div class="clear"></div>
		</div><!-- /.container-inner -->
	
	<?php endwhile; // end of the loop. ?>				
	
<?php get_footer(); 